package Bean;

import java.lang.reflect.Method;
import java.util.Random;

/**
 * @Author czl
 * @Date 2024-03-25
 */
public class Student {

    private String name;
    private int age;
    private Double weight;
    private static final double PI = 3.14;

    public Student() {
    }

    public Student(String name, int age, Double weight) {
        this.name = name;
        this.age = age;
        this.weight = weight;
    }

    public Student(String name, Double weight) {
        this.name = name;
        this.age = 18;
        this.weight = weight;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Double getWeight() {
        return weight;
    }

    public void setWeight(Double weight) {
        this.weight = weight;
    }

    public void hello() {
        System.out.println("你好!");
    }

    private void sleep() {
        System.out.println("睡觉了！");
    }

    public void sayHello(String who) {
        System.out.println("你好," + who);
    }

    public int sum(int i, int j) {
        return i + j;
    }

    @Override
    public String toString() {
        return this.getName()+","+this.getAge()+","+this.getWeight() ;
    }

    public void show() {
        System.out.println("姓名：" + this.name);
        System.out.println("年龄：" + this.age);
        System.out.println("体重：" + this.weight);
    }

    public void Students(String name,Double score){
        this.name=name;
        this.weight=score;
    }

    private int study(String address,Double hour) throws Exception{
        System.out.println("在" + address + "学习力" + hour + "小时");
        // 返回 1-100 的随机数，表示学习获取的经验值
        //return new Random().nextInt(101);
        Class<?> randomClass = Random.class;
        Object obj = randomClass.getConstructor().newInstance();
        Method methods = randomClass.getMethod("nextInt", int.class);
        Object invoke = methods.invoke(obj, 100);
        if (invoke instanceof Integer){
            Integer JiaYan = (Integer) invoke;
            return JiaYan + 1;
        }
        return -1;

    }

}
